<template>
	<view>
		<!-- 页首 -->
		<zw-header></zw-header>
		<!-- 左侧导航栏 -->
		<menu-wrapper active-index="2-1" style="background-color: #fff;padding: 0;">
			<view style="background-image: url('/static/image/user/vip/bg.png');height: 1000px;">
				<view style="display: flex;justify-content: center;align-items: center;">
					<view class="card-header">
						<view class="left" style="color: #C7B480;padding-top: 100rpx;">
							<view>
								<view style="display: flex;justify-content: center;align-items: center;">
									<fui-avatar background="#fff" width="180" :src="loginUser.avator"
										style="top: 48%;"></fui-avatar>
								</view>
								<view class="user-info">
									<view class="user-name elip" style="margin-top: 30rpx;">{{loginUser.name}}</view>
									<view style="margin-top: 30rpx;">
										<view class="vip" v-if="loginUser.vip1"
											style="display: flex;justify-content: center;align-items: center;margin: 0 auto;">
											<image src="../../../static/image/home/vip.png" style="width: 20px;"
												mode="widthFix">
											</image>{{$store.state.loginUser.vipName}}
										</view>
										<view class="vip1" v-if="loginUser.vip2"
											style="display: flex;justify-content: center;align-items: center;margin: 0 auto;">
											<image src="../../../static/image/home/vip1.png" style="width: 20px;"
												mode="widthFix">
											</image>{{$store.state.loginUser.vipName}}
										</view>
										<view class="vip2" v-if="loginUser.vip2"
											style="display: flex;justify-content: center;align-items: center;margin: 0 auto;">
											<image src="../../../static/image/home/vip3.png" style="width: 20px;"
												mode="widthFix">
											</image>{{$store.state.loginUser.vipName}}
										</view>
										<view class="vip3" v-if="loginUser.vip4"
											style="display: flex;justify-content: center;align-items: center;margin: 0 auto;">
											<image src="../../../static/image/home/vip3.png" style="width: 20px;"
												mode="widthFix">
											</image>{{$store.state.loginUser.vipName}}
										</view>
									</view>
									<view
										style="display: flex;margin-top: 30rpx;justify-content: center;align-items: center;">
										<view class="tip">会员有效期至：2024-06-12</view>
										<view class="tip" style="padding-left: 60rpx;">当月可用加速次数：258次</view>
									</view>
								</view>
							</view>
						</view>
						<view class="right" style="display: flex;justify-content: flex-start;">
							<view class="item" style="width: 50%;">
								<view class="name">
									<!-- <fui-divider width="100rpx" dividerColor="#C7B480"></fui-divider> -->
									<view>会员权益</view>
									<!-- <fui-divider width="100rpx" dividerColor="#C7B480"></fui-divider> -->
								</view>
								<fui-table :syswidth="width" full color="#C7B480" style="margin-top: 150rpx;"
									borderColor="#C7B480" textColor="#C7B480" headerBgColor="transparent"
									background="transparent" :itemList="tableData" :header="headerData"></fui-table>

							</view>
							<view class="item" style="width: 50%;padding: 0 180rpx 0 180rpx;">
								<view class="name">开通会员</view>
								<view class="name"
									style="justify-content: flex-start;margin-top: 150rpx;font-size: 18px;">选择套餐类型:
								</view>
								<view class="name" style="justify-content: flex-start;margin-top: 120rpx;">
									<view class="card" :class="cardIndex==1?'card1':''" @click="clickCard(1)">
										<view style="font-size: 16px;font-weight: bold;">白银权益卡</view>
										<view style="font-size: 14px;font-weight: bold;">¥10800元/6个月</view>
									</view>
									<view class="card" :class="cardIndex==2?'card2':''" @click="clickCard(2)"
										style="margin-left: 40rpx;">
										<view style="font-size: 16px;font-weight: bold;">黄金权益卡</view>
										<view style="font-size: 14px;font-weight: bold;">¥21600元/1年</view>
									</view>
									<view class="card" :class="cardIndex==3?'card3':''" @click="clickCard(3)"
										style="margin-left: 40rpx;">
										<view style="font-size: 16px;font-weight: bold;">铂金权益卡</view>
										<view style="font-size: 14px;font-weight: bold;">¥43200元/2年</view>
									</view>
								</view>
								<view class="name"
									style="justify-content: flex-start;margin-top: 120rpx;font-size: 18px;">
									<view style="color: #C7B480;font-size: 18px;font-weight: bold;">增加登录IP:</view>
									<view style="color: #C7B480;font-size: 14px;font-weight: bold;margin-left: 20rpx;">
										此套餐默认送“4个”登录端，增加登录端需支付 ￥3000 /个</view>
								</view>
								<view class="name" style="margin-top: 120rpx;font-size: 18px;">
									<fui-input-number height="200rpx" width="800rpx" signColor="#C7B480" color="#C7B480"
										backgroundColor="transparent" :min="1" :max="9"></fui-input-number>
								</view>
								<view class="name" height="200rpx" width="800rpx"
									style="justify-content: flex-start;margin-top: 120rpx;font-size: 18px;">
									<view>
										<image src="/static/image/user/vip/qr.png" style="width: 260rpx;"
											mode="widthFix"></image>
									</view>
									<view style="margin-left: 140rpx;">
										<view style="display: flex;justify-content: flex-start;align-items: center;">
											<view>应付：</view>
											<view style="color: #C7B480;font-size: 30px;font-weight: 400;">￥43200 元
											</view>
										</view>
										<view style="text-align: left;color: #FFFFFF;font-size: 14px;">使用微信/支付宝扫码支付</view>
										<view style="text-align: left;color: #FFFFFF;font-size: 14px;">刷新二维码</view>
										<view style="text-align: left;color: #FFFFFF;font-size: 14px;">购买即视为同意《会员服务协议》</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>

			</view>
		</menu-wrapper>
		<!-- 页脚 -->
		<!-- <zw-footer></zw-footer> -->
	</view>
</template>

<script>
	import menuWrapper from '@/components/user/common/menu-wrapper.vue';
	import centerConfig from '@/common/config/user/center.config.js';
	import onYangWxTable from '@/components/onYang-wxTable/onYang-wxTable.vue';
	import {
		mapState
	} from 'vuex';

	export default {
		components: {
			menuWrapper,
			onYangWxTable
		},
		data() {
			return {
				...centerConfig,
				accountInfo: {},
				counts: [],
				width: 0,
				tabIndex: 1,
				cardIndex: 1,
				tableData: [{
						"name": "套餐价格",
						"vip": "¥10800元",
						"vip1": "¥21600元",
						"vip2": "¥43200元"
					},
					{
						"name": "使用时长",
						"vip": "6个月",
						"vip1": "12个月",
						"vip2": "24个月"
					},
					{
						"name": "生成次数",
						"vip": "无限",
						"vip1": "无限",
						"vip2": "无限"
					},
					{
						"name": "加速卡",
						"vip": "300次/月",
						"vip1": "500次/月",
						"vip2": "600次/月"
					},
					{
						"name": "VIP服务群",
						"vip": "专属会员服务群",
						"vip1": "专属会员服务群",
						"vip2": "专属会员服务群"
					},
					{
						"name": "登录IP数",
						"vip": "包含1个",
						"vip1": "包含2个",
						"vip2": "包含4个"
					},
					{
						"name": "云空间",
						"vip": "1GB",
						"vip1": "10GB",
						"vip2": "无限"
					},
					{
						"name": "款式融合",
						"vip": "✔",
						"vip1": "✔",
						"vip2": "✔"
					},
					{
						"name": "文字创款",
						"vip": "✔",
						"vip1": "✔",
						"vip2": "✔"
					},
					{
						"name": "局布重绘",
						"vip": "✔",
						"vip1": "✔",
						"vip2": "✔"
					},
					{
						"name": "设辑资讯",
						"vip": "✘",
						"vip1": "✔",
						"vip2": "✔"
					},
					{
						"name": "一键同款",
						"vip": "✘",
						"vip1": "✔",
						"vip2": "✔"
					}
				],
				//基础使用 表头
				headerData: [{
					prop: 'name',
					label: '权益类型'
				}, {
					prop: 'vip',
					label: '白银权益卡'
				}, {
					prop: 'vip1',
					label: '黄金权益卡'
				}, {
					prop: 'vip2',
					label: '铂金权益卡'
				}]
			}
		},
		computed: {
			...mapState(['loginUser']),
			currentTime() {
				const currentHour = new Date().getHours();
				const timeQuantums = ['凌晨', '上午', '下午', '晚上'];
				return timeQuantums[Math.floor(currentHour / 6)];
			}
		},
		onLoad() {
			this.getAccountInfo();
			this.findCounts();
			this.$store.commit('tab', 0);

		},
		onReady() {
			let that = this;
			const query = uni.createSelectorQuery();
			//获取宽度
			query.select('.item').fields({
				size: true
			}, (res) => {
				console.log('item', res)
				that.width = res.width;
				const height = res.height;
			}).exec();
		},
		methods: {
			goUrl(url) {
				uni.navigateTo({
					url: url,
					fail(err) {
						console.log(err)
					}
				})
			},
			clickCard(index) {
				this.cardIndex = index;
				// this.page = 0;
				// this.promos = [];
				// this.findPicture();
			},
			clickOption(index) {
				this.tabIndex = index;
				// this.page = 0;
				// this.promos = [];
				// this.findPicture();
			},
			getAccountInfo() {
				this.$util.request('/security/getAccountInfo', {}, (res) => {
					this.accountInfo = res.accountInfo;
				}, true);
			},
			findCounts() {
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				this.$util.request('/profile/counts', {}, (res) => {
					uni.hideLoading();
					this.counts = res;
				}, true);
			}
		}
	}
</script>

<style lang="scss">
	.card {
		width: 33%;
		padding: 15px;
		color: #C7B480;
		border-radius: 13px;
		opacity: 1;
		box-sizing: border-box;
		border: 1px solid #C7B480;
	}

	.card3 {
		color: #885DD6;
		background: linear-gradient(114deg, #D3C2FF 5%, #D3BAFC 45%, #AB94FE 87%);
	}

	.card2 {
		color: #C08049;
		background: radial-gradient(123% 123% at 0% 10%, #FFECC1 0%, #EAA771 99%);
	}

	.card1 {
		color: #7B91A5;
		background: radial-gradient(55% 55% at 13% 5%, #D8E5EA 0%, #C9D9DE 100%);
	}

	.vip {
		margin: 0 auto;
		padding: 5px;
		font-family: Source Han Sans;
		font-size: 14px;
		font-weight: 900;
		color: #FFFFFF;
		width: 120px;
		height: 20px;
		border-radius: 50px;
		opacity: 1;
		background: radial-gradient(149% 149% at 0% -7%, #8D8D8D 0%, #636363 100%);
	}

	.vip1 {
		margin: 0 auto;
		padding: 5px;
		font-family: Source Han Sans;
		font-size: 14px;
		font-weight: 900;
		color: #7B91A5;
		width: 120px;
		height: 20px;
		border-radius: 50px;
		opacity: 1;
		background: radial-gradient(55% 55% at 13% 5%, #D8E5EA 0%, #C9D9DE 100%);
	}

	.vip2 {
		margin: 0 auto;
		padding: 5px;
		font-family: Source Han Sans;
		font-size: 14px;
		font-weight: 900;
		color: #C08049;
		width: 120px;
		height: 20px;
		border-radius: 50px;
		opacity: 1;
		background: radial-gradient(123% 123% at 0% 10%, #FFECC1 0%, #EAA771 99%);
	}

	.vip3 {
		margin: 0 auto;
		padding: 5px;
		font-family: Source Han Sans;
		font-size: 14px;
		font-weight: 900;
		color: #885DD6;
		width: 120px;
		height: 20px;
		border-radius: 50px;
		opacity: 1;
		background: linear-gradient(104deg, #D3C2FF 5%, #D3BAFC 45%, #AB94FE 87%);
	}

	.lable {
		font-family: 思源黑体;
		font-size: 16px;
		font-weight: bold;
		line-height: normal;
		text-align: center;
		display: flex;
		align-items: center;
		letter-spacing: 0em;

		color: #666666;
	}

	.active {
		font-family: 思源黑体;
		font-size: 16px;
		font-weight: bold;
		line-height: normal;
		display: flex;
		align-items: center;
		letter-spacing: 0em;
		border-bottom: 2px solid #080808;
		color: #000000;
	}

	.banner {
		width: 100%;
		height: 200px;
		margin: 0 auto;
		display: flex;
		justify-content: center;
	}

	.avatar {
		width: 100px;
		height: 100px;
		padding: 4px;
		border: 3px solid #FFFFFF;
		border-radius: 100px;
		object-fit: fill;
	}

	.card-header {
		display: block;
		width: 100%;
		// padding-top: 24px;
		// justify-content: space-between;
		@extend %flex-align-center;

		.left {




			.user-info {
				text-align: center;

				.user-name {
					font-family: Source Han Sans;
					font-size: 24px;
					font-weight: bold;
				}

				.tip {
					font-family: Source Han Sans;
					font-size: 16px;
					font-weight: normal;
					font-feature-settings: "kern" on;
					color: #C7B480;
				}

				.link {
					display: inline-block;
					font-size: 12px;
					margin-top: 10px;
					color: $color-primary;
				}
			}
		}

		.right {
			margin-top: 170rpx;

			.item {
				@extend %flex-align-center;
				padding: 6px 0;
				margin-left: 66rpx;
				color: #757575;
				display: block;
				text-align: center;

				.value {
					font-family: HarmonyOS Sans SC;
					font-size: 18px;
					font-weight: bold;
					line-height: 35px;
					text-align: center;
					letter-spacing: 0px;
					color: #000000;
				}

				.name {
					font-family: 思源黑体;
					font-size: 24px;
					font-weight: 500;
					text-align: center;
					color: #C7B480;
					display: flex;
					justify-content: center;
					align-items: center;
				}
			}

		}
	}

	.card-body {
		display: flex;
		flex-wrap: wrap;
		margin-top: 5px;
		padding-top: 50px;
		border-top: 1px solid $border-color;

		.button {
			margin-bottom: 60px;
			@extend %flex-align-center;

			.btn-icon {
				width: 100px;
				height: 100px;
				border-radius: 50%;
			}

			.right {
				width: 276px;
				margin-left: 20px;

				.top {
					@extend %flex-align-center;
					font-size: 18px;
					font-weight: 400;

					.name {
						color: #757575;
					}

					.value {
						color: $color-primary;
					}
				}

				.link {
					line-height: 1.8;
					@extend %flex-align-center;
					color: #757575;
					cursor: pointer;

					&:hover {
						color: $color-primary;
					}

					.icon {
						font-weight: bold;
					}
				}
			}
		}
	}
</style>